Manager: Memory Manager



Carbon will support the majority of the Memory Manager programming interface. Changes will primarily affect applications that use zones, system memory, or temporary memory. For example, temporary memory allocations in Mac OS X will be allocated in the application's address space. As a result, calling TempNewHandle will effectively be the same as calling NewHandle.

Carbon will not support current functions for accessing the system heap, but Apple will provide new routines to allocate shared and persistent memory. In addition, the virtual memory system in Mac OS X will introduce a number of changes in the addressing model.

By adhering to the following guidelines, you can increase your application's compliance with Mac OS X memory management:

* Try to use memory only within your own application heap. Review the places where you allocate memory in the system heap.

* Do not pass pointers to data among applications through Apple events, Gestalt routines, or other means. For example, don't share Toolbox data structures between applications, because in Mac OS X, each application will run in its own protected address space.

* Do not use inline, hard-coded addresses.

* Do not modify the zone header to increase the number of master pointer blocks allocated by each call to the MoreMasters function. You should instead call MoreMasters multiple times. Each call to More Masters allocates 128 master pointers. Apple may supply a new version of the MoreMasters function that allows you to specify the number of master pointer blocks to allocate. Note, however, that master pointer blocks do not need to be preallocated or optimized in the Mac OS X environment, so the new function will only benefit Carbon applications running on Mac OS 8.

* Don't make assumptions about the layout of memory, such as the relative position of data stored in heaps, stacks, and other memory areas.

* Don't use the DisposePtr or DisposeHandle functions on pointers or handles allocated by Toolbox managers. For example, don't call the function DisposeHandle on a control allocated by the NewControl function; use DisposeControl instead.

* Because Mac OS X applications will run in a large, protected memory space, memory sizing routines such as MaxMem and FreeMem will work differently than they do now.

Unsupported  ApplicationZone

Supported  BlockMove

Supported  BlockMoveData

Supported  BlockMoveDataUncached

Supported  BlockMoveUncached

Supported  BlockZero

Supported  BlockZeroUncached

Supported  CallGrowZoneProc

Supported  CallPurgeProc

Supported  CallUserFnProc

Supported  CheckAllHeaps

Supported  CompactMem

Unsupported  CompactMemSys

Operations on the system heap are not allowed.

Unsupported  DebuggerEnter

Unsupported  DebuggerExit

Unsupported  DebuggerGetMax

Unsupported  DebuggerLockMemory

Unsupported  DebuggerPoll

Unsupported  DebuggerUnlockMemory

Unsupported  DeferUserFn

Supported  DisposeGrowZoneUPP

Supported  DisposeHandle

Supported  DisposePtr

Supported  DisposePurgeUPP

Supported  DisposeUserFnUPP

Supported  EmptyHandle

Unsupported  EnterSupervisorMode

Unsupported  FlushMemory

Supported  FreeMem

Unsupported  FreeMemSys

Operations on the system heap are not allowed in Carbon.

Supported  GetApplLimit

Supported  GetHandleSize

Unsupported  GetPageState

Unsupported  GetPhysical

Supported  GetPtrSize

Unsupported  GetZone

Supported  GrowZoneProcPtr

Supported  GZSaveHnd

Supported  HandAndHand

Unsupported  HandleZone

Supported  HandToHand

Supported  HClrRBit

Supported  HGetState

Supported  HLock

Supported  HLockHi

Supported  HNoPurge

Unsupported  HoldMemory

Supported  HPurge

Supported  HSetRBit

Supported  HSetState

Supported  HUnlock

Unsupported  InitApplZone

Unsupported  InitZone

Unsupported  InlineGetHandleSize

Used by 68K code.

Supported  InvokeGrowZoneUPP

Supported  InvokePurgeUPP

Supported  InvokeUserFnUPP

Supported  IsHandleValid

Supported  IsHeapValid

Supported  IsPointerValid

Unsupported  LockMemory

Unsupported  LockMemoryContiguous

Unsupported  LockMemoryForOutput

Unsupported  MakeMemoryNonResident

Unsupported  MakeMemoryResident

Unsupported  MaxApplZone

This routine is not needed by PowerPC-based applications because they can specify a stack size in the cfrg resource.

Supported  MaxBlock

Unsupported  MaxBlockSys

Supported  MaxMem

Unsupported  MaxMemSys

Supported  MemError

Modified  MoreMasters

MoreMasters will have a longint parameter for specifying the number of master pointers to allocate in the block. Specifying a number less than 32 will result in 32 master pointers in the allocated block, the current standard allocation.

Supported  MoveHHi

Supported  NewEmptyHandle

Unsupported  NewEmptyHandleSys

Supported  NewGrowZoneProc

Supported  NewGrowZoneUPP

Supported  NewHandle

Supported  NewHandleClear

Unsupported  NewHandleSys

Unsupported  NewHandleSysClear

Supported  NewPtr

Supported  NewPtrClear

Unsupported  NewPtrSys

Unsupported  NewPtrSysClear

Supported  NewPurgeProc

Supported  NewPurgeUPP

Supported  NewUserFnProc

Supported  NewUserFnUPP

Unsupported  PageFaultFatal

Supported  PtrAndHand

Supported  PtrToHand

Supported  PtrToXHand

Unsupported  PtrZone

Supported  PurgeMem

Unsupported  PurgeMemSys

Supported  PurgeProcPtr

Supported  PurgeSpace

Supported  PurgeSpaceContiguous

Unsupported  PurgeSpaceSysContiguous

Unsupported  PurgeSpaceSysTotal

Supported  PurgeSpaceTotal

Supported  ReallocateHandle

Unsupported  ReallocateHandleSys

Supported  RecoverHandle

Unsupported  RecoverHandleSys

Unsupported  ReleaseMemoryData

Supported  ReserveMem

Unsupported  ReserveMemSys

Unsupported  SetApplBase

Unsupported  SetApplLimit

Supported  SetGrowZone

Supported  SetHandleSize

Supported  SetPtrSize

Unsupported  SetZone

Supported  StackSpace

Unsupported  StripAddress

There will be no 24-bit memory mode in Mac OS X, so there will be no 24-bit addresses to strip.

Unsupported  SystemZone

Supported  TempDisposeHandle

Supported  TempFreeMem

Supported  TempHLock

Supported  TempHUnlock

Supported  TempMaxMem

Supported  TempNewHandle

Temporary memory allocations will actually come from the applications's address space in Mac OS X. However, Carbon applications running under Mac OS 8.x will be able to get true temporary memory.

Supported  TempTopMem

Supported  TopMem

Unsupported  Translate24To32

There will be no 24-bit memory mode in Mac OS X, so there is no need to translate from 24- to 32-bit addresses.

Unsupported  UnholdMemory

Unsupported  UnlockMemory

Supported  UserFnProcPtr

[Table of Contents] [Manager Index] [Function Index]

Generated on: 7/7/99. Copyright 1999 Apple Computer, Inc. All rights reserved.